package com.atguigu.gmall.item.controller;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.item.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author: atguigu
 * @create: 2023-02-25 11:44
 */
@RestController
@RequestMapping("/api/item")
@SuppressWarnings("all")
public class ItemController {



    @Autowired
    private ItemService itemService;

    /**
     * 提供给前端服务调用RestFul接口实现,汇总商品详情页所需7项数据

     * @return
     */
    @GetMapping("/{skuId}")
    public Result getItemAllData(@PathVariable("skuId") Long skuId) {
       Map<String, Object> data = itemService.getItemAllData(skuId);
       return Result.ok(data);
    }
}
